{extend name="public/base" /}
{block name="head"}

{/block}
{block name="body"}
<div id="fuyun-app" class="fuyun-app">
  <div class="fuyun-title">
    <h5>添加数据</h5>
    <a href="{:Url('index')}" class="layui-btn fuyun-add-btn layui-btn-small layui-btn-normal"><i class="fa fa-plus-square margin-right-5"></i>返回</a>
  </div>

  <div class="content-box">
    <form class="layui-form padding-10" action="{:Url('create')}" method="post">
		  <el-row>
				<el-col :span="12">
					<div class="layui-form-item">
						<label class="layui-form-label">菜单</label>
						<div class="layui-input-inline">
							<select name="parent_id">
								<option value="0">最高级</option>
								{volist name="menuList" id="vo"}
									<option value="{$vo.id}">{$vo.menu_name}</option>
								{/volist}
							</select>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">菜单名字</label>
						<div class="layui-input-inline">
							<input type="text" name="menu_name" lay-verify="title" autocomplete="off" placeholder="请输入分类名字" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">排序</label>
						<div class="layui-input-inline">
							<input type="text" name="sort" placeholder="请输入排序" class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">跳转地址</label>
						<div class="layui-input-block">
							<input type="text" name="url" placeholder="请输入地址" class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">图标</label>
						<div class="layui-input-inline">
							<input type="text" name="icon" placeholder="请输入图标" class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label"></label>
						<div class="layui-input-inline">
				      <input type="radio" name="is_show" value="1" title="显示" checked>
				      <input type="radio" name="is_show" value="0" title="隐藏">
						</div>
					</div>

					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</el-col>
		  </el-row>


    </form>
  </div>
</div>
<script type="text/javascript">

  layui.use(['form'], function(){
      var form = layui.form();
    form.on('submit(formDemo)', function(data){
      var that = this;
      $(that).attr("disabled","disabled"); 
      $.ajax({ 
        type: "post", 
        url: data.form.action, 
        data: data.field,
        dataType: 'json', 
        success: function(result){ 
          if(result['code'] == 1){
            window.location.href = document.referrer;
            layer.msg(result['msg']);
          }else{
            layer.msg(result['msg']);
            $(that).removeAttr("disabled");
          }
        } 
      });

      return false;
    });
  })


  fuyun.components(['page'],{
    el:"#fuyun-app",
    data:{
      labelPosition: 'top',
    },
  });

</script>
{/block}


